/*
    Esta clase es la encargada de representar graficamente
    lo almacenado en ABM_Properties.
    Contiene una referencia a un modelo ABM_Properties.
    Solo actualiza la vista.
*/

#ifndef VISTAPROPERTIES_H_INCLUDED
#define VISTAPROPERTIES_H_INCLUDED

#include <string>
#include <fstream>
#include <iostream>
#include <list>

#include <gtkmm/frame.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/liststore.h>

#include "MyException.h"

#define RUTA_DEFAULT "properties"

#include "ABM_Properties.h"

class Tabla : public Gtk::TreeModel::ColumnRecord
{
  public:
    Tabla()
    {
        add(m_col_Key);
        add(m_col_Value);
    }

    Gtk::TreeModelColumn<Glib::ustring> m_col_Key;
    Gtk::TreeModelColumn<Glib::ustring> m_col_Value;
};

class VistaProperties:public Gtk::TreeView{
    private:
    ABM_Properties& ABM_PRO;
    public:

    VistaProperties(ABM_Properties& ABMP):ABM_PRO(ABMP)
    {
        //Create the Tree model:
        this->m_refTreeModel = Gtk::ListStore::create(this->tabla);
        this->set_model(this->m_refTreeModel);
        //Add the TreeView's view columns:
        this->append_column("Key", tabla.m_col_Key);
        this->append_column("Value", tabla.m_col_Value);
    }


    void ActualizarVista();

    protected:
    Tabla tabla;
    Glib::RefPtr<Gtk::ListStore> m_refTreeModel;

};

#endif // VISTAPROPERTIES_H_INCLUDED
